#include <string.h> 
#define rows 15
#define columns 20

//char test_string[] = { "$GPRMC,161229.487,A,3723.2475,N,12158.3416,W,CHKSUM" }; ////\\
char test_string[] = { "zzz,5,128,200,-120,127,120,7,63,\n" };
char parts[rows][columns];
int whole_ints[10]; 
char *p_start, *p_end; 
int i, j, k;
i = 0; 

int main(void) { 
   p_start = &test_string[0]; 
   while(1) { 
       p_end = strchr(p_start, ','); 
       if (p_end) { 
           strncpy(parts[i], p_start, p_end-p_start);
           whole_ints[i] = atoi(parts[i]); 
           parts[i][p_end-p_start] = 0; 
           i++; 
           p_start = p_end + 1; 
       } 
       else { 
         // sopy the last bit - might as well copy 20 
         strncpy(parts[i], p_start, 20); 
           break; 
       } 
   } 
   printf("hi there \nfuck n you %s \n" ,test_string);
  
  for (j =0; j<=rows-1; j++)
  {for (k=0; k<=columns - 1; k++)
        {
        if ((parts[j][k]) !=0 )        
        printf ("array line %d, element %d hex %x is; %c ; \n" , j, k, parts[j][k], parts[j][k]);
        //printf("
        }
        printf ("between variables; next array line is %d \n", j+1);
        }
        for (i=0; i <=10; i++)
        {
        printf ("converted to integer whole number %d \t", whole_ints[i]);
        printf ("converted to integer whole number %d \n", (unsigned char)whole_ints[i]);
        }
        for (j =0; j<=rows-1; j++)
        {
        whole_ints[j] = (unsigned char)whole_ints[j];
        printf ("converted to integer whole number %i \n", whole_ints[j]);
        }
  // while(1); 
}
